﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Xierun.Migrations
{
    public partial class dd : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Base_User",
                columns: table => new
                {
                    Id = table.Column<string>(maxLength: 50, nullable: false),
                    CompanyId = table.Column<string>(nullable: true),
                    DepartmentId = table.Column<string>(nullable: true),
                    InnerUser = table.Column<int>(nullable: true),
                    Code = table.Column<string>(nullable: true),
                    Account = table.Column<string>(nullable: true),
                    Password = table.Column<string>(nullable: true),
                    Secretkey = table.Column<string>(nullable: true),
                    RealName = table.Column<string>(nullable: true),
                    Spell = table.Column<string>(nullable: true),
                    Gender = table.Column<string>(nullable: true),
                    Birthday = table.Column<DateTime>(nullable: true),
                    Mobile = table.Column<string>(nullable: true),
                    Telephone = table.Column<string>(nullable: true),
                    OICQ = table.Column<string>(nullable: true),
                    Email = table.Column<string>(nullable: true),
                    ChangePasswordDate = table.Column<DateTime>(nullable: true),
                    OpenId = table.Column<int>(nullable: true),
                    LogOnCount = table.Column<int>(nullable: true),
                    FirstVisit = table.Column<DateTime>(nullable: true),
                    PreviousVisit = table.Column<DateTime>(nullable: true),
                    LastVisit = table.Column<DateTime>(nullable: true),
                    AuditStatus = table.Column<string>(nullable: true),
                    AuditUserId = table.Column<string>(nullable: true),
                    AuditUserName = table.Column<string>(nullable: true),
                    AuditDateTime = table.Column<DateTime>(nullable: true),
                    Online = table.Column<int>(nullable: true),
                    Remark = table.Column<string>(nullable: true),
                    Enabled = table.Column<int>(nullable: true),
                    SortCode = table.Column<int>(nullable: true),
                    DeleteMark = table.Column<int>(nullable: true),
                    CreateDate = table.Column<DateTime>(nullable: true),
                    CreateUserId = table.Column<string>(nullable: true),
                    CreateUserName = table.Column<string>(nullable: true),
                    ModifyDate = table.Column<DateTime>(nullable: true),
                    ModifyUserId = table.Column<string>(nullable: true),
                    ModifyUserName = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Base_User", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ChatCommand",
                columns: table => new
                {
                    Id = table.Column<string>(maxLength: 50, nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: true),
                    Type = table.Column<string>(maxLength: 50, nullable: true),
                    Content = table.Column<string>(maxLength: 50, nullable: true),
                    Url = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ChatCommand", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ChatCommandParam",
                columns: table => new
                {
                    Id = table.Column<string>(maxLength: 50, nullable: false),
                    Name = table.Column<string>(maxLength: 50, nullable: false),
                    Type = table.Column<string>(maxLength: 50, nullable: true),
                    Content = table.Column<string>(maxLength: 50, nullable: true),
                    Url = table.Column<string>(maxLength: 50, nullable: true),
                    ChatCommandId = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ChatCommandParam", x => x.Id);
                });

            migrationBuilder.CreateIndex(
                name: "IX_ChatCommand_Name",
                table: "ChatCommand",
                column: "Name",
                unique: true,
                filter: "[Name] IS NOT NULL");

            migrationBuilder.CreateIndex(
                name: "IX_ChatCommandParam_Name",
                table: "ChatCommandParam",
                column: "Name",
                unique: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Base_User");

            migrationBuilder.DropTable(
                name: "ChatCommand");

            migrationBuilder.DropTable(
                name: "ChatCommandParam");
        }
    }
}
